﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 枚举
{

    /**
     * 枚举放在命名空间的下面，类的外面，
     * 表示命名空间中的类都可以用。
     * 枚举类型和int类型是兼容的
     */
    enum Season : byte
    {
        Spring = 1,
        Summer = 2,
        Autumn = 3,
        Winter = 4
    }

    enum Gender : int
    {
        MALE = 1,
        FMALE = 2
    }

    enum QQStatus
    {
        online,offline,outWork,inWork
    }

    class Program
    {
        static void Main(string[] args)
        {
            Season a = Season.Spring;
            a = Season.Winter;
            Console.WriteLine(a);
            byte b = 1;
            if((byte)a == b)
            {
                Console.WriteLine("相同");
            }
            else
            {
                Console.WriteLine("不同");
            }
            Gender g = (Gender)Enum.Parse(typeof(Gender), "1");
            Console.WriteLine(g);

            string online = QQStatus.online.ToString();
            Console.WriteLine(QQStatus.online);
            Console.WriteLine(online);


            double dou = Convert.ToDouble(QQStatus.online);
            Console.WriteLine(dou);

            Console.ReadKey();
        }
    }
}
